package service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vo.User;
import dao.UserDao;
import service.UserService;
@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Resource
	private UserDao userDao;


	public void delete(User user) {

		this.userDao.removeUser(user);

	}

	public List<User> findAll() {

		return this.userDao.findAllUserser();

	}

	public ArrayList<User> findUserByArgus(String hql,Object[] params) {

		return this.userDao.findUserByArgus(hql, params);

	}

	public void save(User user) {

		this.userDao.saveUser(user);

	}

	public void update(User user) {

		this.userDao.updateUser(user);

	}

	public User findUserByName(String name) {
		return this.userDao.findUserByName(name);
	}

	public List<Object> search(String hql, Object[] params, int start, int length) {
		List<Object> ret = (List<Object>)userDao.search(hql, params,start, length);
		ret.add(0, userDao.count(params[0].toString()));
		
		return ret;
	}

}
